package com.ppg.basic.concurrent;

import com.google.common.collect.Lists;

import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

public class Main {


    public static AtomicInteger count = new AtomicInteger(0);


    public static void main(String[] args) {

        List<Thread> list = Lists.newArrayList();
        for (int i = 0; i < 1000; i++) {
            list.add(new Thread(() -> count.incrementAndGet()));
        }

        list.forEach(Thread::start);

        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println(count);
    }
}
